package com.hxk.ioText.charIo.nodeIo;

import java.io.CharArrayReader;
import java.io.CharArrayWriter;
import java.io.IOException;

public class CharArrayIo {

	public static void main(String[] args) {
		CharArrayReader car = null;
		CharArrayWriter caw = null;
		try {
			caw = new CharArrayWriter();
			caw.write("java 字符数组流");
			car = new CharArrayReader(caw.toCharArray());
			char[] cbuf = new char[1024];
			int len = car.read(cbuf);
			String s = new String(cbuf, 0, len);
			System.out.println(s);
		} catch (IOException e) {
			e.printStackTrace();
		}finally {
			if(car != null) {
				car.close();
			}
			if(caw != null) {
				caw.close();
			}
		}
	}

}
